test(e2e): run playwright via container#37300
Conversation
|
I can test this on Arch Linux, which so far was unable to run playwright. |
|
I am doing exactly that :) unfortunately I think the |
223c5cd to
61dd882
Compare
|
Wouldn’t that require the developer to install Docker? |
|
we have docker target for one. I'm working on skipping the deps install on non-debian/ubuntu installs though and toggling based on that. |
|
BTW another approach for limited e2e tests on Arch could be to detect But overall I agree that if |
|
#37315 will revert the webkit addition, to unstable. With webkit gone, it may be feasible to run chromium and firefox natively. |
Chromium works well. Firefox? I can't get it to work at all because some glib stuff or something. container should be more stable overall for systems not blessed by playwright. I'll default to local unless OS is linux and it's not ubuntu/debian. I know I can gate it, just need to fight makefile a bit... though maybe instead I just should write a script like a sane person. Does makefile and e2e even works under windows? |
In theory if you have go,node,docker,pnpm available, it may work but I think it's very likely you hit some issue. Real confirmation could only come if we could make CI run on windows runners which I think are not configured. BTW webkit on macos runners should work reliably but again, I don't think our self-hosted runner infrastructure provides such runners. |
|
It was more of a "should I be concerned about it" question. I don't think the test script for e2e would work as it needs bash but I don't exactly have a way of trying it. shell it is as conditionals in makefile are a pain |
|
No, for all we are concerned, only Linux and MacOS have to work. |
|
But... why? This is just "run in container" but with more steps and requiring act runner, docker daemon and installing browsers which are built-in in the playwright container. I don't follow. |
|
Goal should be that |
Assisted-by: gemini-cli:gemini-3-flash
|
I will test later. |
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
|
Resolved the conflicts caused by my changes. Just a question: when using container, many test flags like |
|
It would seem that they don't unfortunately. I can more or less work around that, just running full suite was basically impossible. Playwright support on unsupported platforms is pretty bad - who would've guessed :) |
|
I meant that I personally can probably work around that issue. It would be just plugging chromium binary to the script and running natively, which is a hack and not worth upstreaming (if it works) as I'd expect majority of people using e2e to run it instead of making new tests, especially on unsupported platforms. I'll add some comments in a bit. |
|
Tested on Arch Linux, 54 tests failed with "getaddrinfo ENOTFOUND localhost", so this does seem to depend on "localhost" being dns-resolvable, which may be some debian/ubuntu specific thing. After adding |
Apparently this was a misconfiguration on my side, https://wiki.archlinux.org/title/Network_configuration#:~:text=local%20hostname |
- guard `docker stop` in cleanup with `|| true` so a failed stop doesn't skip server kill / workdir removal - use a unique container name per process (`gitea-e2e-runner-$$`) so concurrent runs don't collide - drop `-it` from `docker run` (meaningless with `-d`) - strip leading semver range from PLAYWRIGHT_VERSION so a `^`/`~` in package.json doesn't break the image tag - normalize indentation to 2 spaces (matches .editorconfig) - fail fast with a clear message if container mode is selected but the runtime is not installed - drop unconditional 5s sleep in wait_for_container; poll immediately Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
|
Pushed some cleanups in 8134227. |
- normalise CONTAINER_RUNTIME once at the top of the script and drop the `?= docker` default + recipe passthrough from the Makefile (env vars inherit; command-line make vars auto-export) - replace `node` invocation for version extraction with `sed` - extract a shared `free_port` helper and use it for both the gitea server port and a dynamically allocated playwright run-server port - rewrite `wait_for_container` to probe the playwright TCP port via bash's `/dev/tcp` instead of grepping `docker logs`; fixed 1s polling with a 30s budget; dump container logs on timeout - skip `docker pull` when the image is already present locally - drop narration comments Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Signed-off-by: silverwind <me@silverwind.io>
- guard `shift` so direct invocation of the script with no args doesn't exit under `set -e` - validate the parsed @playwright/test version against a strict semver-ish regex; rejects empty / malformed values and prevents shell injection into the container's `sh -c` command - detect early container exit inside the readiness loop and dump logs immediately instead of waiting out the 30s budget - drop the container-mode timeout-factor bump; the existing CI=4 / 1 buckets plus the manual override env var cover the real cases - move PLAYWRIGHT_SERVER_PORT allocation out of the install path - trim narration comments Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Signed-off-by: silverwind <me@silverwind.io>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
wxiaoguang
left a comment
There was a problem hiding this comment.
Haven't really tested on linux, overall code looks good.
|
Tested latest commit on Arch, works. |
* origin/main: feat(api): add last_sync to repository API (go-gitea#37566) test(e2e): run playwright via container (go-gitea#37300) # Conflicts: # models/migrations/migrations.go # models/migrations/v1_27/v332.go
* main: fix(deps): update dependency mermaid to v11.15.0 [security], add e2e test (go-gitea#37662) ci: Also lint json5 files (go-gitea#37659) fix(templates): avoid misleading compare message when branches lack merge base (go-gitea#37651) fix(deps): update npm dependencies (go-gitea#37647) refactor: routing info middleware (go-gitea#37653) chore(deps): update action dependencies (major) (go-gitea#37638) fix(deps): update go dependencies (major) (go-gitea#37639) ci(renovate): update Go import paths on major bumps (go-gitea#37641) fix(packages): Add label for private and internal package and fix composor package source permission check (go-gitea#37610) refactor: replace Fomantic search module with first-party code (go-gitea#37443) fix(deps): update npm dependencies (go-gitea#37636) fix(deps): update module code.gitea.io/sdk/gitea to v0.25.0 (go-gitea#37637) feat(api): add last_sync to repository API (go-gitea#37566) test(e2e): run playwright via container (go-gitea#37300) feat(editor): broaden language detection in web code editor (go-gitea#37619) refactor(log): replace log.Critical with log.Error (go-gitea#37624) fix: "run as root" check (go-gitea#37622) fix: improve actions status icons and texts (go-gitea#37206) # Conflicts: # pnpm-workspace.yaml

Enable running playwright tests on unsupported platforms as well